<template>
  <div>
    <div class="header-name">
      <search :options="selectData" :msg="tacitly" @seek="collect" @hand="balance" />
      <el-button type="primary" class="btn" size="mini" @click="balance">{{ $t('btn.search') }}</el-button>
    </div>
    <div>
      <jc-table
        :table-data="tableData"
        :table-header="tableHeader"
        table-height="438px"
      />
    </div>
    <div class="footer">
      <jc-pagination
        :total="total"
        :page.sync="currentPage"
        :limit.sync="size"
        @pagination="balance"
      />
    </div>
  </div>
</template>

<script>
import search from '@/components/Search'
import searData from '@/components/Search/mixin'
import { queryRealTimeDataBalance } from '@/api/homePage/business'

export default {
  components: {
    search
  },
  mixins: [searData],
  data() {
    return {
      ftype: 0,
      tableData: [],
      tableHeader: [
        { label: '独立核算部门', prop: '' },
        { label: '负责人', prop: '' },
        { label: '部门人数', prop: '' },
        { label: '预计产值或销售额', prop: '' },
        { label: '营业额(含税)', prop: '' },
        { label: '退税', prop: '' },
        { label: '部门利润', prop: '' },
        { label: '毛利率', prop: '' },
        { label: '计件工资', prop: '' },
        { label: '计时工资', prop: '' },
        { label: '工资占比', prop: '' },
        { label: '部门费用', prop: '' },
        { label: '费用占比', prop: '' },
        { label: '固定费用', prop: '' },
        { label: '固定费用占比', prop: '' },
        { label: '料工费合计', prop: '' },
        { label: '料工费比率', prop: '' },
        { label: '成本合计', prop: '' }
      ],
      currentPage: 1,
      size: 200,
      total: 0
    }
  },
  created() {
    // this.balance()
  },
  methods: {
    // 独立核算部门经营分析报表
    balance() {
      const DATA = {
        pageNum: this.currentPage,
        pageSize: this.size,
        search: this.searCollData,
        fnumber: this.LargeCode
      }
      queryRealTimeDataBalance(DATA).then(res => {
        if (res.code === 0) {
          this.tableData.push(...res.data.array)
          this.total = res.data.total
        }
      })
    }
  }
}
</script>

<style scoped lang="scss">
.header-name {
  position: relative;
  top: -5px;
  margin-bottom: 10px;
  .btn {
    margin-left: 450px;
    transform: translateY(18%);
  }
}
</style>

